<form id="pagerForm" method="post" action="">
	<input type="hidden" name="pageNum" value="{$pageNum}" />
	<input type="hidden" name="numPerPage" value="{$numPerPage}" />
	<input type="hidden" name="orderField" value="{$orderField}" />
	<input type="hidden" name="orderDirection" value="{$orderDirection}" />
	<input type="hidden" name="keywords" value="{$keywords}" />
	<input type="hidden" name="sfield" value="{$sfield}" />
	<input type="hidden" name="platform" value="SMW01" />
</form>

<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="" method="post">
		<input type="hidden" name="m" value="{$module_name}" />
		<input type="hidden" name="a" value="{$action_name}" />
	<div class="searchBar">
		<ul class="searchContent">
			<li style="width:210px;">
				<label style="width:60px;">关键字：</label>
				<input type="text" class="autoinput" name="keywords" value="{$keywords}" style="width:120px;"/>
			</li>
			<li style="width:85px;">
			<select name="sfield" class="">	
				<option value="all">全部</option>		
				<option value="o.id" {if $wherefields =='id'} selected="selected" {/if}>订单ID</option>
				<option value="o.userid" {if $wherefields=='userid'} selected="selected" {/if}>用户ID</option>
				<option value="sn"  {if $wherefields=='sn'} selected="selected" {/if}>订单编号</option>
			</select>
			<input type="hidden" name="sfield_name" value="o.id,o.userid,sn" />
			</li>
		
			<div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div>
		</ul>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
		<li><a class="edit" href="{:U('Order/give_list')}" title="确认赠送3天之前，订单已完成并且未赠送的吗？" target="ajaxTodo"><span>赠送3天之前已完成PV</span></a></li>
		</ul>
	</div>
	<div id="w_list_print">
		<style>
			table tr{text-align:center;}
		</style>
	<table class="list" width="100%" targetType="navTab" layoutH="96">
		<thead>
			<tr>
				<th width="40">订单编号</th>
				<th width="100">用 户 ID</th>
				<th width="100">科目</th>
				<th width="100">金额</th>
				<th width="100">状 态</th>
				<th width="170">操 作</th>
			</tr>
		</thead>
		<tbody>
<volist name="info" id="vo">
			<tr target="sid_dv" rel="{$vo['id']}">
				<td>{$vo['sn']}</td>
				<td>{$vo['userid']}</td>
				<td>{$vo['subject']}</td>
				<td>{$vo['value']/100|number_format=###,2,'.',''}</td>
				<td>{$staut[$vo['status']]}</td>
				<td>{if $vo['ostatus'] == '10' AND $vo['status'] == '0' }<input type="button" value="赠送" onclick="give({$vo['id']})">{/if}</td>
			</tr>
</volist>
		</tbody>
	</table>
	</div>
<include file="Index:pages" />
</div>
<script>
function give(id){
	$(function (){
		$.ajax({
		  type: "POST",
		  data:'id='+id,
		  url: "{:U('Order/give')}",
		  success: function(msg){
		     if(msg){
			 	alert('赠送成功！');
			 }else{
			 	alert('赠送失败！');
			 }
			 navTab.reload();
		   }
		 });
	});
}
	
	
	
function smw_print(){	  
	var ids =document.getElementsByName("b2bids[]");
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }      
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Print&a=smw_print&ids="+oids);
	}
}
function smw_psdprint(){
	var ids =document.getElementsByName("b2bids[]");	
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }     
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Print&a=smw_psdprint&ids="+oids);
	}
}
</script>